<template>
  <el-dialog :title="title" v-if="open" v-model="open" width="1200px" append-to-body>
    <!-- <el-card class="box-card" shadow="always" :body-style="{ padding: '20px' }"> -->

    <el-table border v-loading="loading" :data="dataSource">
      <el-table-column label="#" type="index"> </el-table-column>
      <el-table-column label="报价单号" align="center" prop="quotationCode" />
      <el-table-column label="日期" align="center" prop="quotationTime" width="220" />
      <el-table-column label="客户名称" align="center">
        <template #default="scope">
          {{ scope.row.jzgSupplierVo && scope.row.jzgSupplierVo.supplierName || '' }}
        </template>
      </el-table-column>
      <el-table-column label="联系人" align="center" prop="quotationName" />
      <!-- <el-table-column label="方案" align="center" prop="warehouseName" /> -->
      <el-table-column label="适用价格" align="center" prop="applyPrice" />
      <el-table-column label="报价状态" align="center" prop="quotationStatus">
        <template #default="scope">
          <el-tag :type="getType(scope.row.quotationStatus)" size="normal" effect="dark">
            {{ selectDictLabel(quote_status, scope.row.quotationStatus) }}

          </el-tag>

        </template>
      </el-table-column>
      <el-table-column label="备注" align="center" prop="remark" />
    </el-table>
    <pagination v-show="total > 0" :total="total" v-model:page.sync="queryParams.pageNum"
      v-model:limit.sync="queryParams.pageSize" @pagination="getList" />
    <!-- </el-card> -->

    <template #footer>
      <div class="dialog-footer">
        <el-button @click="cancel">取 消</el-button>
        <el-button type="primary" @click="submit">确定</el-button>
      </div>
    </template>
  </el-dialog>
</template>

<script>
import listMixin from '@/mixins/listMixin';
export default {
  name: "selectMaterialForm",
  mixins: [listMixin],
  data() {
    return {
      open: false, // Dialog display state
      showSearch: true, // Whether to show the search form
      title: '关联报价单',
      queryParams: { // Query parameters for the table
        pageNum: 1, // Current page number
        pageSize: 10, // Number of records per page
      },
      dateRange: [], // Date range for the created time
      loading: false, // Loading state of the table
      dataSource: [], // Data for the table
      total: 0, // Total number of records
      multiple: false, // Whether multiple rows are selected
      quote_status: [], // Quote status
      supplierOptions: [],//客户
      quotationSchemeOptions: [],//方案
      currentRow: {}, // Current row data
      urls: {
        list: '/order/quotation/list',
        delete: '/order/quotation',
      }
    }
  },

  methods: {
    show(row) {
      console.log('show')
      this.open = true;
      this.getDicts(['quote_status'])
      this.queryParams.schemeId = row.id
      this.getList()
    },
    submit() {
      this.$emit('ok', this.selectedRows)
      this.open = false;
    },
    cancel() {
      this.open = false;
    },

    rowClick(row, column, event) {
      this.$refs.table.toggleRowSelection(row);
    },

    getType(status) {
      switch (status) {
        case '0':
          return 'primary';
        case '1':
          return 'success';
        case '2':
          return 'danger';
        default:
          return 'info';
      }
    },
  }
}
</script>

<style lang="scss" scoped></style>